package me.exchange.com.modules.system.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.amazonaws.services.dynamodbv2.xspec.N;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.CreationTimestamp;

import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.sql.Timestamp;

/**
* @author 张玉丰
* @date 2020-04-11
*/
@Entity
@Getter
@Setter
@Table(name="t_dict")
@org.hibernate.annotations.Table(appliesTo = "t_dict",comment="数据字典表")
public class Dict implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    @ApiModelProperty(name = "id",value = "ID",required = false)
    private Long id;

    /** 字典名称 */
    @Column(name = "dictionary_name",nullable = false)
    @NotBlank
    @ApiModelProperty(name = "dictionaryName",value = "字典名称")
    private String dictionaryName;

    /** 数据项key */
    @Column(name = "filed_key")
    @ApiModelProperty(name = "filedKey",value = "数据项key",required = false)
    private String filedKey;
    /** 数据项key */
    @Column(name = "data_key")
    @ApiModelProperty(name = "dataKey",value = "字段编码key",required = false)
    private String dataKey;

    /** 数据项value */
    @Column(name = "data_val")
    @ApiModelProperty(name = "dataVal",value = "数据项value",required = false)
    private String dataVal;

    /** 描述 */
    @Column(name = "describe")
    @ApiModelProperty(name = "describe",value = "描述",required = false)
    private String describe;

    /** 备注 */
    @Column(name = "remark")
    @ApiModelProperty(name = "remark",value = "备注",required = false)
    private String remark;

    /** 排序 */
    @Column(name = "sort")
    @ApiModelProperty(name = "sort",value = "排序",required = false)
    private Long sort;

    /** 创建人 */
    @Column(name = "c_admin_id")
    @ApiModelProperty(name = "cAdminId",value = "创建人",required = false)
    private Long cAdminId;

    /** 创建日期 */
    @Column(name = "c_admin_time")
    @CreationTimestamp
    @ApiModelProperty(name = "cAdminTime",value = "创建日期",required = false)
    private Timestamp cAdminTime;

    /** 修改人 */
    @Column(name = "u_admin_id")
    @ApiModelProperty(name = "uAdminId",value = "修改人",required = false)
    private Long uAdminId;

    /** 修改时间 */
    @Column(name = "u_admin_time")
    @CreationTimestamp
    @ApiModelProperty(name = "uAdminTime",value = "修改日期",required = false)
    private Timestamp uAdminTime;

    /** 是否删除 1未删除 0 删除 */
    @Column(name = "isdel")
    @ApiModelProperty(name = "isdel",value = "是否删除 1未删除 0删除")
    private Boolean isdel;

    public void copy(Dict source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}